<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<title>客户管理</title>
<link rel="shortcut icon" href="easyui/css/images/favicon.ico" />
<link rel="stylesheet" href="css/flipclock.css">
<link href="css/CalcSS3.css" rel="stylesheet" type="text/css" />
<link href="css/index.css" rel="stylesheet" type="text/css" />
<link href="easyui/css/easyui.css" rel="stylesheet" type="text/css">
<link href="easyui/css/easyui_animation.css" rel="stylesheet"
	type="text/css">
<link href="easyui/css/easyui_plus.css" rel="stylesheet" type="text/css">
<link href="easyui/css/insdep_theme_default.css" rel="stylesheet"
	type="text/css">
<link href="easyui/css/icon.css" rel="stylesheet" type="text/css">
<link href="easyui/css/font-awesome-4.7.0/css/font-awesome.min.css"
	rel="stylesheet" type="text/css">




</head>
<body style="padding: 10px">
	<style>
.by {
	padding: 10px;
	text-align: center;
}
</style>

	<!-- 引入公用表格和表单样式 -->
	<link href="css/utils/utilsDatagrid.css" rel="stylesheet"
		type="text/css">
	<link href="css/utils/utilsForm.css" rel="stylesheet" type="text/css">
	<link href="css/client/client.css" rel="stylesheet" type="text/css">
	<!-- 引入client页面js文件 -->
	<script type="text/javascript" src="js/client/client.js"></script>
	<!-- 客户阶段选项卡 -->
	<div id="jm-client-datagrid-tab" class="easyui-tabs"
		style="border: 0px; width: 100%"
		data-options="border:false,plain:true">

		<div title="全部客户" style="padding: 5px; display: none;"
			data-options="border:false,index:0"></div>
		<div title="潜在客户" style="padding: 5px; display: none;"
			data-options="border:false,border:false,index:1"></div>
		<div title="签约客户" style="padding: 5px; display: none;"
			data-options="border:false,index:2"></div>
		<div title="重复购买" style="padding: 5px; display: none;"
			data-options="border:false,index:3"></div>
		<div title="失效客户" style="padding: 5px; display: none;"
			data-options="border:false,index:4"></div>
	</div>

	<!-- 头部搜索框 -->
	<div class="client-searchbox-div">
		<input id="client-searchbox" class="easyui-searchbox"
			style="width: 300px;"
			data-options="menu:'#client-searchbox-checkbox',labelWidth:80"></input>

		<div id="client-searchbox-checkbox" style="width: 120px"
			data-options="left:5">
			<div data-options="name:'cname',selected:true">客户名称</div>
			<div data-options="name:'cid'">客户编号</div>
		</div>

		<a id="client-search-btn" class="easyui-linkbutton"
			data-options="text:'高级查询'"
			style="margin-left: 10px; padding: 5px 10px;"></a>
	</div>

	<!-- 高级查询框 -->
	<div class="client-advance-search">
		<form id="client-advance-search-form" method="post" action="">
			<table>
				<tr>
					<td style="width: 20%; text-align: right;"><label>高级查询</label></td>
					<td style="width: 40%"><a id="client-advance-search-btn"
						href="#" class="easyui-linkbutton"
						data-options="iconCls:'icon-back',text:'返回快速查询'"></a></td>
					<td style="width: 40%"><input name="page" type="hidden">
						<input name="rows" type="hidden"></td>
				</tr>

				<tr>
					<td style="width: 20%; text-align: right;"><label>ID：</label></td>
					<td style="width: 40%"><input name="cid"
						class="easyui-textbox" style="width: 100%"></td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>客户名称：</label></td>
					<td style="width: 40%"><input name="cname"
						class="easyui-textbox" style="width: 100%"></td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>阶段：</label></td>
					<td style="width: 40%"><input type="radio" name="stage"
						value="潜在"><label>潜在</label> <input type="radio"
						name="stage" value="签约"><label>签约</label> <input
						type="radio" name="stage" value="重复购买"><label>重复购买</label>
						<input type="radio" name="stage" value="失效"><label>失效</label>
					</td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>种类：</label></td>
					<td style="width: 40%"><input type="radio" name="type"
						value="客户"><label>客户</label> <input type="radio"
						name="type" value="供应商"><label>供应商</label> <input
						type="radio" name="type" value="合作伙伴"><label>合作伙伴</label>
						<input type="radio" name="type" value="媒体"><label>媒体</label>
						<input type="radio" name="type" value="其他"><label>其他</label>
					</td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>关系等级：</label></td>
					<td style="width: 40%"><input type="radio" name="relationship"
						value="密切"><label>密切</label> <input type="radio"
						name="relationship" value="较好"><label>较好</label> <input
						type="radio" name="relationship" value="一般"><label>一般</label>
						<input type="radio" name="relationship" value="较差"><label>较差</label>
					</td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>来源：</label></td>
					<td style="width: 40%"><input name="source"
						class="easyui-textbox" style="width: 100%"></td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>行业：</label></td>
					<td style="width: 40%"><input name="industry"
						class="easyui-textbox" style="width: 100%"></td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>人员规模：</label></td>
					<td style="width: 40%"><input type="radio" name="scale"
						value="10人以内"><label>10人以内</label> <input type="radio"
						name="scale" value="10-50人"><label>10-50人</label> <input
						type="radio" name="scale" value="50-200人"><label>50-200人</label>
						<input type="radio" name="scale" value="200-500人"><label>200-500人</label>
						<input type="radio" name="scale" value="500人以上"><label>500人以上</label>
					</td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>信用等级：</label></td>
					<td style="width: 40%"><input type="radio" name="credit"
						value="高"><label>高</label> <input type="radio"
						name="credit" value="中"><label>中</label> <input
						type="radio" name="credit" value="低"><label>低</label></td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>所有者：</label></td>
					<td style="width: 40%"><input name="userId"
						class="easyui-combobox"
						data-options="valueField: 'uId',textField: 'uname', 
		   				url: 'client-get-all-user',"
						style="width: 100%"></td>
					<td style="width: 40%"></td>
				</tr>

				<tr>
					<td style="width: 20%; text-align: right;"><label>电话：</label></td>
					<td style="width: 40%"><input name="phone"
						class="easyui-textbox" style="width: 100%"></td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>传真：</label></td>
					<td style="width: 40%"><input name="fax"
						class="easyui-textbox" style="width: 100%"></td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>网址：</label></td>
					<td style="width: 40%"><input name="url"
						class="easyui-textbox" style="width: 100%"></td>
					<td style="width: 40%"></td>
				</tr>

				<tr>
					<td style="width: 20%; text-align: right;"><label>创建日期：</label></td>
					<td style="width: 40%"><input name="createStartTime"
						class="easyui-datebox" style="width: 45%"> <a href="#"
						class="easyui-linkbutton" data-options="text:'到',disabled:true"
						style="width: 8%; height: 100%"></a> <input name="createEndTime"
						class="easyui-datebox" style="width: 45%"></td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>地址：</label></td>
					<td style="width: 40%"><input name="address"
						class="easyui-textbox" style="width: 100%"></td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>备注：</label></td>
					<td style="width: 40%"><input name="remarks"
						class="easyui-textbox" style="width: 100%"></td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"><label>更新日期：</label></td>
					<td style="width: 40%"><input name="updateStartTime"
						class="easyui-datebox" style="width: 45%"> <a href="#"
						class="easyui-linkbutton" data-options="text:'到',disabled:true"
						style="width: 8%; height: 100%"></a> <input name="updateEndTime"
						class="easyui-datebox" style="width: 45%"></td>
					<td style="width: 40%"></td>
				</tr>
				<tr>
					<td style="width: 20%; text-align: right;"></td>
					<td style="width: 40%; text-align: center;"><a
						id="client-advance-btn" class="easyui-linkbutton"
						data-options="text:'查询',width:50"></a></td>
					<td style="width: 40%"></td>
				</tr>

			</table>
		</form>
	</div>

	<!-- 基本信息/财务数据 -->
	<div id="jm-client-datagrid-data" class="easyui-tabs"
		data-options="plain:true,pill:true,border:false"
		style="border: 0px; width: 100%">

		<div title="基本信息" data-options="border:false"
			style="display: none; border: 0px;">

			<table id="jm-client-datagrid" class="easyui-datagrid table-chance"
				style="width: 100%"
				data-options="striped:true,height:350,fitColumns:true,scrollbarSize:0,
			   autoRowHeight:true,nowrap:false,pagination:true,toolbar:'#jm-client-tools',url:'find-all-clint-info',
			pageList:[5,10,15,20],pageSize:5">
				<thead>
					<tr class="datagrid-header-row">
						<th
							data-options="field:'code',width:10,align:'center',checkbox:true">编码</th>
						<th data-options="field:'cid',width:30,align:'center'">ID</th>
						<th data-options="field:'cname',width:100,align:'center'">客户名称</th>
						<th data-options="field:'type',width:60,align:'center'">种类</th>
						<th
							data-options="field:'userId',width:40,align:'center',formatter:function(value){
							var result;
							$.ajax({
								url:'client-get-userName', 
								async:false,//改为同步请求
								type:'POST',
								data:{uId:value},
								success:function(e){
									result = e;
								}
							});
							return result;
						}">所有者</th>
						<th data-options="field:'stage',width:40,align:'center'">阶段</th>
						<th data-options="field:'address',width:50,align:'center'">地址</th>
						<th data-options="field:'industry',width:80,align:'center'">行业</th>
						<th data-options="field:'createDate',width:60,align:'center'">创建日期</th>
						<th data-options="field:'updateDate',width:80,align:'center'">更新日期</th>
						<th data-options="field:'operation',width:90,align:'center'"
							formatter="format">操作</th>

					</tr>
				</thead>
				<tbody>
				</tbody>
			</table>
			<!--datagrid工具栏-->
			<div id="jm-client-tools">
				<a id="client-tools-btn-add" class="easyui-linkbutton"
					data-options="iconCls:'icon-mini_add2',plain:true">新建</a> <a
					id="client-tools-btn-remove" href="#" class="easyui-linkbutton"
					data-options="iconCls:'icon-my_delete',plain:true">删除</a> <a
					id="client-tools-btn-selectAll" class="easyui-linkbutton"
					data-options="iconCls:'icon-my_search',plain:true">查询所有</a><a
					id="client-tools-btn-transfer" href="#" class="easyui-linkbutton"
					data-options="iconCls:'icon-jm-transfer',plain:true"
					style="float: right;">批量转移</a> <a id="client-tools-btn-xiazai"
					href="#" class="easyui-linkbutton"
					data-options="iconCls:'icon-xiazai',plain:true,width:32"
					style="float: right;" title="导出数据到excel"></a> <a
					id="client-tools-btn-shangchuan" href="#" class="easyui-linkbutton"
					data-options="iconCls:'icon-shangchuan',plain:true,width:32"
					style="float: right;" title="从excel导入客户数据"></a>
			</div>

			<!-- 客户转移对话框 -->
			<div id="transfer-client-dialog" class="easyui-dialog"
				data-options="title:'客户转移',
					iconCls:'icon-save2',
					width:600,
					height:500,
					closed:true,
					href:'to-client-transfer',
					bodyCls:'by',
					shadow:true,
				">

			</div>

			<!-- 新建客户对话框 -->
			<div id="add-client-dialog" class="easyui-dialog"
				style="background-color: #EBEFF2;"
				data-options="title:'新建客户',
						iconCls:'icon-save2',
						width:750,
						height:350,
						closed:true,
						href:'to-add-client-form',
						bodyCls:'by',
						shadow:true,
						buttons:[{
							text:'保存',
							iconCls:'icon-ok2',
							handler:function(){
								//提交表单事件
								$('#add-client-form').form({
									onSubmit:function(parmps){
										//进行验证
										return $(this).form('validate');
									},
									success:function(r){
										r = eval('('+r+')');
										if(r.result.success){
											//点击关闭，则窗口关闭
											$.messager.alert('成功', '恭喜，成功添加客户！');
											$('#add-client-dialog').window('close');
											$('#add-client-form').form('clear');
		            						$('#jm-client-datagrid').datagrid('reload');
										}else{
											$.messager.alert('错误', r.result.message);
										}
									}
								}).submit();
							}
       					
						},
						 {
							text:'继续完善信息',
							iconCls:'icon-undo',
							handler:function(){
								//提交表单事件
								$('#add-client-form').form({
									onSubmit:function(parmps){
										//进行验证
										return $(this).form('validate');
									},
									success:function(r){
										r = eval('('+r+')');
										if(r.result.success){
											//点击关闭，则窗口关闭
											$('#add-client-dialog').window('close');
											$('#add-client-form').form('clear');
		            						$('#jm-client-datagrid').datagrid('reload');
		            						$('#edit-client-form').form('clear');
											$('#edit-client-dialog').window('open').panel({
												onLoad : function() {
													$('#edit-client-form').form('load', r.clientInfo);
												}
											});
										}else{
											$.messager.alert('错误', r.result.message);
										}
									}
								}).submit();
							}
						},
						{
							text:'关闭',
							iconCls:'icon-cancel2',
							handler:function(){
								//点击关闭，则窗口关闭
								$('#add-client-dialog').window('close');
							}
						}
						]
						 "></div>

			<!-- 编辑客户对话框 -->
			<div id="edit-client-dialog" class="easyui-dialog"
				style="background-color: #EBEFF2;"
				data-options="title:'客户基本信息',
						iconCls:'icon-save2',
						width:750,
						height:700,
						closed:true,
						href:'to-edit-client-form',
						bodyCls:'by',
						shadow:true,
						buttons:[{
							text:'保存',
							iconCls:'icon-ok2',
							handler:function(){
								//提交表单事件
								$('#edit-client-form').form({
									onSubmit:function(parmps){
										//进行验证
										return $(this).form('validate');
									},
									success:function(r){
										r = eval('('+r+')');
										if(r.success){
											//点击关闭，则窗口关闭
											$.messager.alert('成功', '恭喜，成功编辑客户！');
											$('#edit-client-dialog').window('close');
											$('#edit-client-form').form('clear');
		            						$('#jm-client-datagrid').datagrid('reload');
										}else{
											$.messager.alert('错误', r.message);
										}
									}
								}).submit();
							}
       					
						},
						{
							text:'关闭',
							iconCls:'icon-cancel2',
							handler:function(){
								//点击关闭，则窗口关闭
								$('#edit-client-dialog').window('close');
							}
						}
						]
						 "></div>

			<!-- 客户视图对话框 -->
			<div id="view-client-dialog" class="easyui-dialog"
				style="background-color: #EBEFF2;"
				data-options="title:'客户基本信息',
						iconCls:'icon-save2',
						width:750,
						height:700,
						closed:true,
						href:'to-view-client',
						bodyCls:'by',
						shadow:true
						 "></div>
		</div>

		<!-- <div title="财务数据" data-options="border:false,border:false"
			style="padding: 5px; display: none; border: 0px;">ds</div> -->

	
	</div>

	
	
</body>
</html>
